import { h } from 'vue'
import {callConfirmMethod} from '@/common/layer-com-utils.js'
import bindMerchantCom from '@/components/layer-components/bindMerchant/bindMerchant.vue'
import merchantWalletCom from '@/components/layer-components/merchantWallet/merchantWallet.vue'
export * from '@/components/layer-components/food-withdraw-list/layer-com.js'
export * from '@/components/layer-components/msg-detailed-view/layer-com.js'

/**
 * 为用户表中的商户 绑定商户号
 * @param {Object} serverData - 用户表中用户的基本信息
 */
export function layerBindMerchant(serverData){
    let confirmMethod=[];
    layer.open({
        title:`绑定商户`,
        type:1,
        area:[`450px`,`380px`],
        content:h(bindMerchantCom,{
            serverData,
            callback:(arrayFn)=>confirmMethod=arrayFn
        }), 
        appContext:getApp().$vm.$.appContext,
        shade: true, 
        shadeClose:false,
        btn: [{
            text:`关联绑定`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[0],layerId)
        },{
            text:`清除绑定`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[1],layerId)
        }]
    })
}
/**
 * 操作商户的钱包数据
 * @param {Object} serverData - 商户表中商户的基本信息
 */
export function layerMerchantWallet(serverData){
    let confirmMethod=[];
    layer.open({
        title:`商户钱包`,
        type:1,
        area:[`430px`,`520px`],
        content:h(merchantWalletCom,{
            serverData,
            callback:(arrayFn)=>confirmMethod=arrayFn
        }), 
        appContext:getApp().$vm.$.appContext,
        shade: true, 
        shadeClose:false,
        btn: [{
            text:`确认操作`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[0],layerId)
        },{
            text:`取消关闭`, 
            callback: (layerId) =>callConfirmMethod.call(this,confirmMethod[1],layerId)
        }]
    })
}